package com.smile.utils.param;

/**
 * 
 * 返回值code枚举
 * 
 * @author lyc
 *
 */
public enum ReturnResultCode {

	/**
	 * 成功
	 */
	SUCCESS(1000),
	/**
	 * 通用失败、运行时异常
	 */
	FAIL_EXCEPTION(1001),
	/**
	 * 身份验证失败
	 */
	FAIL_AUTHORITY(1002),
	/**
	 * 字段验证失败
	 */
	FAIL_FIELD(1003);

	private ReturnResultCode(int code) {
		this.code = code;
	}

	private int code;

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public static ReturnResultCode valueOf(int code) {
		ReturnResultCode[] values = values();
		for (ReturnResultCode c : values) {
			if (c.getCode() == code) {
				return c;
			}
		}
		return null;
	}
}
